#include "commanddispatcher.h"
#include "command.h"
#include "../cmds/strokecommand.h"

namespace ShCo
{

class CommandDispatcherImpl : public Impl<CommandDispatcher>
{
public:
    void init();
    void exit();
    Command* _cmd;
};

void CommandDispatcherImpl::init()
{
    _cmd = new StrokeCommand();
}

void CommandDispatcherImpl::exit()
{
    SH_SAFE_DELETE(_cmd);
}

CommandDispatcher::CommandDispatcher()
{
    SH_I(CommandDispatcher);
    d->init();
}

CommandDispatcher::~CommandDispatcher()
{
    SH_E(CommandDispatcher);
    d->exit();
}

Command* CommandDispatcher::command() const
{
    SH_D(const CommandDispatcher);
    return d->_cmd;
}

} // namespace ShCo
